package com.chainyoung.component_tmperson.ui.mvp.presenter;

import com.chainyoung.common.appcommon.entity.CommonList;
import com.chainyoung.common.base.CommonSubscriber;
import com.chainyoung.common.di.scope.ActivityScope;
import com.chainyoung.common.di.scope.FragmentScope;
import com.chainyoung.common.mvp.BasePresenter;
import com.chainyoung.common.utils.RxUtils;
import com.chainyoung.component_tmperson.entity.Purse;
import com.chainyoung.component_tmperson.entity.PurseAddr;
import com.chainyoung.component_tmperson.ui.mvp.contract.WalletAddrContract;
import com.chainyoung.component_tmperson.ui.mvp.contract.WalletContact;

import java.util.TreeMap;

import javax.inject.Inject;


@ActivityScope
public class WalletAddrPresenter extends BasePresenter<WalletAddrContract.Model, WalletAddrContract.View> {


    @Inject
    public WalletAddrPresenter(WalletAddrContract.Model model, WalletAddrContract.View rootView) {
        super(model, rootView);
    }


    public void getMyPurse(TreeMap<String, Object> map) {
        addSubscribe(mModel.getPurseAddr(map)
                .compose(RxUtils.<PurseAddr>rxSchedulerHelper())
                .subscribeWith(new CommonSubscriber<PurseAddr>(mView) {
                    @Override
                    public void onNext(PurseAddr data) {
                        mView.onGetPurseAddrSuccess(data);
                    }

                    @Override
                    public void onError(Throwable e) {
                        super.onError(e);
                    }
                }));
    }


}
